package demo2;

interface IShape {
//    public static final int age=10;
    public abstract void draw();

//    default void func() {
//        System.out.println("default!");
//    }
//
//    public static void staticFunc() {
//        System.out.println("static!");
//    }
}

class Rect implements IShape {
    //实例化这个接口意味着 你要重写这个接口所有的抽象方法

    @Override
    public void draw() {
        System.out.println("画一个矩形！");
    }
}

class Circle implements IShape {
    @Override
    public void draw() {
        System.out.println("画一个圆圈！");
    }
}

class Triangle implements IShape {
    @Override
    public void draw() {
        System.out.println("画一个三角形！");
    }
}


//interface也会生成一个新的字节码文件
public interface ITestInterface {
    public static void drawMap(IShape iShape) {
        iShape.draw();
    }
    public static void main(String[] args) {
        drawMap(new Circle());
        drawMap(new Triangle());
        drawMap(new Rect());

    }
}
